package com.erp.erp_servers.bill_exchange.Imp;


import com.erp.erp_dao.BillExchangeInfo.IBillExchangeCostInfoDao;
import com.erp.erp_entitys.BillExchangeInfo.BillExchangeCostInfo;
import com.erp.erp_servers.bill_exchange.BillExchangeCostInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 结汇费用表(BillExchangeCostInfo)表服务实现类
 *
 * @author makejava
 * @since 2021-01-15 21:13:34
 */
@Service("billExchangeCostInfoService")
public class BillExchangeCostInfoServiceImpl implements BillExchangeCostInfoService {
    @Resource
    private IBillExchangeCostInfoDao billExchangeCostInfoDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public BillExchangeCostInfo queryById(Long id) {
        return this.billExchangeCostInfoDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<BillExchangeCostInfo> queryAllByLimit(int offset, int limit) {
        return this.billExchangeCostInfoDao.queryAllByLimit(offset, limit);
    }

    @Override
    public List<BillExchangeCostInfo> queryAll(BillExchangeCostInfo cost) {
        return this.billExchangeCostInfoDao.queryAll(cost);
    }

    /**
     * 新增数据
     *
     * @param billExchangeCostInfo 实例对象
     * @return 实例对象
     */
    @Override
    public BillExchangeCostInfo insert(BillExchangeCostInfo billExchangeCostInfo) {
        this.billExchangeCostInfoDao.insert(billExchangeCostInfo);
        return billExchangeCostInfo;
    }

    /**
     * 修改数据
     *
     * @param billExchangeCostInfo 实例对象
     * @return 实例对象
     */
    @Override
    public BillExchangeCostInfo update(BillExchangeCostInfo billExchangeCostInfo) {
        this.billExchangeCostInfoDao.update(billExchangeCostInfo);
        return this.queryById(billExchangeCostInfo.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.billExchangeCostInfoDao.deleteById(id) > 0;
    }
}